package com.wwz.service.impl;

import com.wwz.datasource.annotation.DS;
import com.wwz.datasource.constants.DataSourceConstants;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class TestService {

    @Resource
    private JdbcTemplate jdbcTemplate;

    public List<Map<String, Object>> test1(){
        List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from room");
        return maps;
    }

    @DS(value = DataSourceConstants.DS_KEY_SLAVE)
    public List<Map<String, Object>> test2(){
        List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from bs_user");
        return maps;
    }
}
